package nettcp;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

public class J_TCPClient {
    public static void main(String[] args) {
        try {
            Socket s = new Socket("192.168.5.100",5000);
            DataOutputStream dataOutputStream = new DataOutputStream(s.getOutputStream());
            dataOutputStream.writeUTF("I want to connect");
            dataOutputStream.flush();
            DataInputStream dataInputStream = new DataInputStream(s.getInputStream());
            System.out.println("Accept the server message:"+dataInputStream.readUTF());
            dataOutputStream.close();
            dataInputStream.close();
            s.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
